#include "RemoteCandidate.h"

namespace cm_nat
{
    RemoteCandidate::RemoteCandidate():m_component(0),m_ip(0),m_port(0)
    {

    }

    RemoteCandidate::~RemoteCandidate()
    {

    }

    Tag* RemoteCandidate::tag()
    {
        Tag* p_tag = new Tag("remote-candidate");
        p_tag->addAttribute("component", m_component);
        p_tag->addAttribute("ip",m_ip);
        p_tag->addAttribute("port", m_port);
        
        return p_tag;
    }

    bool RemoteCandidate::parse(Tag* p_tag)
    {
        m_component = NumberParser::parseUnsigned(p_tag->findAttribute("component"));
        m_ip = p_tag->findAttribute("ip");
        m_port = NumberParser::parseUnsigned(p_tag->findAttribute("port"));

        return true;
    }

}